<?php
class table_boan_payment_log extends discuz_table {
    var $vars;
    function __construct(){
        global $_G;
        $this->_table = 'boan_payment_log';
        $this->_pk    = 'lid';
      
        if(empty($_G['cache']['plugin'])){
            loadcache('plugin');
        }
        
        $this->vars = $_G['cache']['plugin']['boan_payment'];
        parent::__construct();
    }
    function insert_log($data){
        if(!empty($this->vars['diary_ct']) && $this->count() > $this->vars['diary_ct']){
            $sql = 'SELECT min(lid) FROM '.DB::table('boan_payment_log');
            $query = DB::query($sql);
            $lid = DB::result($query, 0); 
            $this->delete($lid);
        }
        $this->insert($data);
    }
}